package com.mybatis.service;

import com.mybatis.dto.request.CodeGenerationParam;
import com.mybatis.dto.request.DatabaseParam;
import com.mybatis.message.ReturnResult;

import javax.servlet.http.HttpServletResponse;

/**
 * @desc: 代码生成相关接口
 * @projectName: mybatis-generator-parent
 * @author: xhs
 * @date: 2023-7-22 022 15:18
 * @version: JDK 1.8
 */
public interface GeneratorService {

    /**
     * 数据库连接测试
     *
     * @param databaseParam 数据库连接入参
     * @return ReturnResult
     */
    ReturnResult<Object> databaseConnection(DatabaseParam databaseParam);

    /**
     * 获取数据库所有表名称
     *
     * @param databaseParam 数据库连接入参
     * @return ReturnResult
     */
    ReturnResult<Object> getTableNameList(DatabaseParam databaseParam);

    /**
     * 代码生成
     *
     * @param codeGenerationParam 代码生成入参
     * @return ReturnResult
     */
    ReturnResult<Object> codeGeneration(CodeGenerationParam codeGenerationParam);

    /**
     * 下载生成的代码
     *
     * @param fileUrl  文件路径
     * @param response response
     */
    void downloadCode(HttpServletResponse response, String fileUrl);
}
